package models;

import javax.persistence.*;

import java.sql.Timestamp;
import java.util.Collection;

/**
 * Created by john on 2016/9/11.
 */
@Entity
@Table(name = "t_ContractInfo")
public class ContractInfo_T_Entity {
	private Integer fdRowId;
	private Integer deleted = 0;
	private String fdContractNumber;
	private Integer fdDeptAid;
	private Integer fdDeptBid;
	private String fdDestination;
	private Double fdExcutedQty;
	private String fdLoadPlace;
    private String fdModifiedDate;
	private Integer fdProductId;
	private Double fdQuantity;
	private String fd_LastDay;
	
/*
	private Collection<TApplyInfoEntity> tApplyInfosByFdRowId;
	
	private UserInfo_T_Entity tUserInfoByFdUserAid;
	private UserInfo_T_Entity tUserInfoByFdUserBid;
	private DeptInfo_T_Entity tDeptInfoByFdDeptAid;
	private DeptInfo_T_Entity tDeptInfoByFdDeptBid;
	private TProductInfoEntity tProductInfoByFdProductId;
	private Collection<DeliveryOrder_V_Entity> tDeliveryOrdersByFdRowId;
*/
	@Id
	@GeneratedValue
	@Column(name = "fd_RowID", nullable = false)
	public Integer getFdRowId() {
		return fdRowId;
	}

	public void setFdRowId(Integer fdRowId) {
		this.fdRowId = fdRowId;
	}

	@Basic
	@Column(name = "deleted", nullable = false)
	public Integer getDeleted() {
		return deleted;
	}

	public void setDeleted(Integer deleted) {
		this.deleted = deleted;
	}

	@Basic
	@Column(name = "fd_ContractNumber", nullable = false, length = 50)
	public String getFdContractNumber() {
		return fdContractNumber;
	}

	public void setFdContractNumber(String fdContractNumber) {
		this.fdContractNumber = fdContractNumber;
	}

	@Basic
	@Column(name = "fd_LoadPlace", nullable = false, length = 100)
	public String getFdLoadPlace() {
		return fdLoadPlace;
	}

	public void setFdLoadPlace(String fdLoadPlace) {
		this.fdLoadPlace = fdLoadPlace;
	}

	@Basic
	@Column(name = "fd_Destination", nullable = false, length = 100)
	public String getFdDestination() {
		return fdDestination;
	}

	public void setFdDestination(String fdDestination) {
		this.fdDestination = fdDestination;
	}

	@Basic
	@Column(name = "fd_Quantity", nullable = false)
	public Double getFdQuantity() {
		return fdQuantity;
	}

	public void setFdQuantity(Double fdQuantity) {
		this.fdQuantity = fdQuantity;
	}

	@Basic
	@Column(name = "fd_ExcutedQty", nullable = false)
	public Double getFdExcutedQty() {
		return fdExcutedQty;
	}

	public void setFdExcutedQty(Double fdExcutedQty) {
		this.fdExcutedQty = fdExcutedQty;
	}

	@Basic
	@Column(name = "fd_DeptAID", nullable = false)
	public Integer getFdDeptAid() {
		return fdDeptAid;
	}

	public void setFdDeptAid(Integer fdDeptAid) {
		this.fdDeptAid = fdDeptAid;
	}

	@Basic
	@Column(name = "fd_DeptBID", nullable = false)
	public Integer getFdDeptBid() {
		return fdDeptBid;
	}

	public void setFdDeptBid(Integer fdDeptBid) {
		this.fdDeptBid = fdDeptBid;
	}



	@Basic
	@Column(name = "fd_ModifiedDate", nullable = false)
	public String getFdModifiedDate() {
		return fdModifiedDate;
	}

	public void setFdModifiedDate(String fdModifiedDate) {
		this.fdModifiedDate = fdModifiedDate;
	}

	@Basic
	@Column(name = "fd_ProductID", nullable = true)
	public Integer getFdProductId() {
		return fdProductId;
	}

	public void setFdProductId(Integer fdProductId) {
		this.fdProductId = fdProductId;
	}
	
	public String getFd_LastDay() {
		return this.fd_LastDay;
	}

	public void setFd_LastDay(String fd_LastDay) {
		this.fd_LastDay = fd_LastDay;
	}


/*
	@OneToMany(mappedBy = "tContractInfoByFdContractId")
	public Collection<TApplyInfoEntity> gettApplyInfosByFdRowId() {
		return tApplyInfosByFdRowId;
	}


	public void settApplyInfosByFdRowId(
			Collection<TApplyInfoEntity> tApplyInfosByFdRowId) {
		this.tApplyInfosByFdRowId = tApplyInfosByFdRowId;
	}

	

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((destinationLatitude == null) ? 0 : destinationLatitude
						.hashCode());
		result = prime
				* result
				+ ((destinationLongitude == null) ? 0 : destinationLongitude
						.hashCode());
		result = prime
				* result
				+ ((fdContractNumber == null) ? 0 : fdContractNumber.hashCode());
		result = prime * result
				+ ((fdDeptAid == null) ? 0 : fdDeptAid.hashCode());
		result = prime * result
				+ ((fdDeptBid == null) ? 0 : fdDeptBid.hashCode());
		result = prime * result
				+ ((fdDestination == null) ? 0 : fdDestination.hashCode());
		result = prime * result
				+ ((fdExcutedQty == null) ? 0 : fdExcutedQty.hashCode());
		result = prime * result
				+ ((fdLoadPlace == null) ? 0 : fdLoadPlace.hashCode());
		result = prime * result
				+ ((fdModifiedDate == null) ? 0 : fdModifiedDate.hashCode());
		result = prime * result
				+ ((fdProductId == null) ? 0 : fdProductId.hashCode());
	
		result = prime * result
				+ ((fdQuantity == null) ? 0 : fdQuantity.hashCode());
		result = prime * result + ((fdRowId == null) ? 0 : fdRowId.hashCode());
		result = prime * result
				+ ((fdUserAid == null) ? 0 : fdUserAid.hashCode());
		result = prime * result
				+ ((fdUserBid == null) ? 0 : fdUserBid.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContractInfo_T_Entity other = (ContractInfo_T_Entity) obj;
		if (destinationLatitude == null) {
			if (other.destinationLatitude != null)
				return false;
		} else if (!destinationLatitude.equals(other.destinationLatitude))
			return false;
		if (destinationLongitude == null) {
			if (other.destinationLongitude != null)
				return false;
		} else if (!destinationLongitude.equals(other.destinationLongitude))
			return false;
		if (fdContractNumber == null) {
			if (other.fdContractNumber != null)
				return false;
		} else if (!fdContractNumber.equals(other.fdContractNumber))
			return false;
		if (fdDeptAid == null) {
			if (other.fdDeptAid != null)
				return false;
		} else if (!fdDeptAid.equals(other.fdDeptAid))
			return false;
		if (fdDeptBid == null) {
			if (other.fdDeptBid != null)
				return false;
		} else if (!fdDeptBid.equals(other.fdDeptBid))
			return false;
		if (fdDestination == null) {
			if (other.fdDestination != null)
				return false;
		} else if (!fdDestination.equals(other.fdDestination))
			return false;
		if (fdExcutedQty == null) {
			if (other.fdExcutedQty != null)
				return false;
		} else if (!fdExcutedQty.equals(other.fdExcutedQty))
			return false;
		if (fdLoadPlace == null) {
			if (other.fdLoadPlace != null)
				return false;
		} else if (!fdLoadPlace.equals(other.fdLoadPlace))
			return false;
		if (fdModifiedDate == null) {
			if (other.fdModifiedDate != null)
				return false;
		} else if (!fdModifiedDate.equals(other.fdModifiedDate))
			return false;
		if (fdProductId == null) {
			if (other.fdProductId != null)
				return false;
		} else if (!fdProductId.equals(other.fdProductId))
			return false;
	
		if (fdQuantity == null) {
			if (other.fdQuantity != null)
				return false;
		} else if (!fdQuantity.equals(other.fdQuantity))
			return false;
		if (fdRowId == null) {
			if (other.fdRowId != null)
				return false;
		} else if (!fdRowId.equals(other.fdRowId))
			return false;
		if (fdUserAid == null) {
			if (other.fdUserAid != null)
				return false;
		} else if (!fdUserAid.equals(other.fdUserAid))
			return false;
		if (fdUserBid == null) {
			if (other.fdUserBid != null)
				return false;
		} else if (!fdUserBid.equals(other.fdUserBid))
			return false;
		return true;
	}

	@ManyToOne
	@JoinColumn(name = "fd_UserAID", referencedColumnName = "fd_UserID", nullable = false, insertable = false, updatable = false)
	public UserInfo_T_Entity gettUserInfoByFdUserAid() {
		return tUserInfoByFdUserAid;
	}

	public void settUserInfoByFdUserAid(UserInfo_T_Entity tUserInfoByFdUserAid) {
		this.tUserInfoByFdUserAid = tUserInfoByFdUserAid;
	}

	@ManyToOne
	@JoinColumn(name = "fd_UserBID", referencedColumnName = "fd_UserID", nullable = false, insertable = false, updatable = false)
	public UserInfo_T_Entity gettUserInfoByFdUserBid() {
		return tUserInfoByFdUserBid;
	}

	public void settUserInfoByFdUserBid(UserInfo_T_Entity tUserInfoByFdUserBid) {
		this.tUserInfoByFdUserBid = tUserInfoByFdUserBid;
	}

	@ManyToOne
	@JoinColumn(name = "fd_DeptAID", referencedColumnName = "fd_DeptID", nullable = false, insertable = false, updatable = false)
	public DeptInfo_T_Entity gettDeptInfoByFdDeptAid() {
		return tDeptInfoByFdDeptAid;
	}

	public void settDeptInfoByFdDeptAid(DeptInfo_T_Entity tDeptInfoByFdDeptAid) {
		this.tDeptInfoByFdDeptAid = tDeptInfoByFdDeptAid;
	}

	@ManyToOne
	@JoinColumn(name = "fd_DeptBID", referencedColumnName = "fd_DeptID", nullable = false, insertable = false, updatable = false)
	public DeptInfo_T_Entity gettDeptInfoByFdDeptBid() {
		return tDeptInfoByFdDeptBid;
	}

	public void settDeptInfoByFdDeptBid(DeptInfo_T_Entity tDeptInfoByFdDeptBid) {
		this.tDeptInfoByFdDeptBid = tDeptInfoByFdDeptBid;
	}

	@ManyToOne
	@JoinColumn(name = "fd_ProductID", referencedColumnName = "fd_RowID", insertable = false, updatable = false)
	public TProductInfoEntity gettProductInfoByFdProductId() {
		return tProductInfoByFdProductId;
	}

	public void settProductInfoByFdProductId(
			TProductInfoEntity tProductInfoByFdProductId) {
		this.tProductInfoByFdProductId = tProductInfoByFdProductId;
	}

	@OneToMany(mappedBy = "tContractInfoByFdContractId")
	public Collection<DeliveryOrder_V_Entity> gettDeliveryOrdersByFdRowId() {
		return tDeliveryOrdersByFdRowId;
	}

	private String destinationLongitude;

	public void settDeliveryOrdersByFdRowId(
			Collection<DeliveryOrder_V_Entity> tDeliveryOrdersByFdRowId) {
		this.tDeliveryOrdersByFdRowId = tDeliveryOrdersByFdRowId;
	}

	
	@Basic
	@Column(name = "destinationLongitude", nullable = true, length = 20)
	public String getDestinationLongitude() {
		return destinationLongitude;
	}

	public void setDestinationLongitude(String destinationLongitude) {
		this.destinationLongitude = destinationLongitude;
	}

	private String destinationLatitude;

	@Basic
	@Column(name = "destinationLatitude", nullable = true, length = 20)
	public String getDestinationLatitude() {
		return destinationLatitude;
	}

	public void setDestinationLatitude(String destinationLatitude) {
		this.destinationLatitude = destinationLatitude;
	}
*/
	


}
